<?php

/**
 * Feedback filter form base class.
 *
 * @package    KrazyTaxi
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseFeedbackFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'IDUSUARIO'            => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUserProfile', 'add_empty' => true)),
      'PATENTETAXI'          => new sfWidgetFormPropelChoice(array('model' => 'Taxi', 'add_empty' => true)),
      'FECHAFEEDBACK'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'CALIFICACIONFEEDBACK' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'COMENTARIOFEEDBACK'   => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'IDUSUARIO'            => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUserProfile', 'column' => 'IDUSUARIO')),
      'PATENTETAXI'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Taxi', 'column' => 'PATENTETAXI')),
      'FECHAFEEDBACK'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'CALIFICACIONFEEDBACK' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'COMENTARIOFEEDBACK'   => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('feedback_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Feedback';
  }

  public function getFields()
  {
    return array(
      'IDFEEDBACK'           => 'Number',
      'IDUSUARIO'            => 'ForeignKey',
      'PATENTETAXI'          => 'ForeignKey',
      'FECHAFEEDBACK'        => 'Date',
      'CALIFICACIONFEEDBACK' => 'Number',
      'COMENTARIOFEEDBACK'   => 'Text',
    );
  }
}
